package com.wuxiaofan.ware.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.ware.entity.WareInfo;
import com.wuxiaofan.ware.entity.custom.WareInfoCustom;
import com.wuxiaofan.ware.mapper.WareInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.ware.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class WareInfoService {
    @Autowired
    private WareInfoMapper wmsWareInfoMapper;
    @Resource
    private Idgenerator idgenerator;
    public WareInfo findById(String id){
        return wmsWareInfoMapper.selectById(id);
    }

    public WareInfoCustom findCountByMap(Map paraMap){
        return wmsWareInfoMapper.findCountByMap(paraMap);
    }

    public WareInfoCustom findGroupByMap(Map paraMap){
        return wmsWareInfoMapper.findGroupByMap(paraMap);
    }

    public List<WareInfoCustom> findByMap(Map paraMap){
        return wmsWareInfoMapper.findByMap(paraMap);
    }

    public Page<WareInfoCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(wmsWareInfoMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        wmsWareInfoMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        wmsWareInfoMapper.deleteById(id);
    }

    public WareInfo save(WareInfo wmsWareInfo){
        wmsWareInfo.setId(idgenerator.getId());
        wmsWareInfoMapper.insert(wmsWareInfo);
        return wmsWareInfo;
    }

}
